import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
import '@/styles/index.scss' // global css
import App from './App'
import store from './store'
import router from './router'
import '@/icons' // icon
import '@/permission' // permission control
import * as directive from './directive' // 导入自定义指令

import * as filters from '@/filters' // 引入工具类
import components from '@/components' // 复用组件库
import PageTools from '@/components/PageTools'
import print from 'vue-print-nb'
import Calendar from '@/views/dashboard/components/calendar.vue'
import '@/styles/element-variables.scss'

import i18n from '@/lang'

// 配置ElementUI的中英切换逻辑
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})

Vue.use(ElementUI)
// 注册全局的过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

import ScreenFull from '@/components/ScreenFull/index.vue'
Vue.component('ScreenFull', ScreenFull) // 注册全屏组件

// Vue.use => 插件内的install方法调用
Vue.use(components)
Vue.use(print)

// 公用组件
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.component('PageTools', PageTools) // 全局可以使用
Vue.component('Calendar', Calendar) // 全局可以使用

Vue.config.productionTip = false
// 批量注册全局指令
Object.keys(directive).forEach(key => {
  Vue.directive(key, directive[key])
})
new Vue({
  // el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')
